Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: social history conversion #7

Merged
merged 15 commits into from
Nov 14, 2024
Merged

Conversation

mcmcgrath13
Copy link
Member

@mcmcgrath13 mcmcgrath13 commented Nov 7, 2024

This PR turned a little meandering - apologies.

  • Allow social history entries that have a value which is coded with nullFlavor = UNK to still be converted as long as they have original text in their value field
  • Make sure that all converted social history observations are referenced in the social history section (and not more than did get converted)
  • Abstract out the logic of whether to convert a social history observation to the Util/IsSocialHistoryObservation template.
    • This template contains boolean logic to figure out if we should convert it or not then renders the result at the end. We can then capture this result when including the template in another template and use its value to simplify/dry out the code there
  • Use case/when to dry out a lot of repeated template ID-ing (and also add the check to look at the first as sometimes this had more than one thing and then the old logic just wasn't hitting 😬 )
  • remove the extra special casing for SOCIALOBS in the social history _entry.liquid and just make it a normal special case as it wasn't needed and was causing weird merged objects because we were also converting it in the regular way.
  • Create a utility template for handling value[x] fhir mappings and use it in a lot of places

Base automatically changed from mcm/problem-list-note to main November 7, 2024 18:17
@mcmcgrath13 mcmcgrath13 changed the title fix: convert original text if available fix: clean up social history handling Nov 8, 2024
@mcmcgrath13 mcmcgrath13 changed the title fix: clean up social history handling fix: social history conversion Nov 8, 2024
@mcmcgrath13 mcmcgrath13 marked this pull request as ready for review November 13, 2024 20:17
Copy link
Collaborator

@BobanL BobanL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question about how something works but this is really great!

data/Templates/eCR/Utils/_ValueHelper.liquid Show resolved Hide resolved
Comment on lines +140 to +141
{% include 'Section/SocialHistory' SOCIALOBS: socialObs SOCIALTEXT: socialHistoryText -%}
{% include 'Resource/Patient' patientRole: msg.ClinicalDocument.recordTarget.patientRole ID: patientId SOCIALOBS: socialObs SOCIALTEXT: socialHistoryText contact: msg.ClinicalDocument.participant.associatedEntity -%}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

socialHistoryText isn't defined yet right? So is the point of passing the blank socialHistoryText to Section/SocialHistory to give it a value that can be used in Resource/Patient?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it's a weird hack that takes advantage of leaky variable scopes 😬

@mcmcgrath13 mcmcgrath13 merged commit 15f380d into main Nov 14, 2024
2 checks passed
@mcmcgrath13 mcmcgrath13 deleted the mcm/fix-social-history-obs branch November 14, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants